<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>Class: MySpace::MySpaceContext</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  <meta http-equiv="Content-Script-Type" content="text/javascript" />
  <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
  <script type="text/javascript">
  // <![CDATA[

  function popupCode( url ) {
    window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
  }

  function toggleCode( id ) {
    if ( document.getElementById )
      elem = document.getElementById( id );
    else if ( document.all )
      elem = eval( "document.all." + id );
    else
      return false;

    elemStyle = elem.style;
    
    if ( elemStyle.display != "block" ) {
      elemStyle.display = "block"
    } else {
      elemStyle.display = "none"
    }

    return true;
  }
  
  // Make codeblocks hidden by default
  document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
  
  // ]]>
  </script>

</head>
<body>



    <div id="classHeader">
        <table class="header-table">
        <tr class="top-aligned-row">
          <td><strong>Class</strong></td>
          <td class="class-name-in-header">MySpace::MySpaceContext</td>
        </tr>
        <tr class="top-aligned-row">
            <td><strong>In:</strong></td>
            <td>
                <a href="../../files/myspace/context/MySpaceContext_rb.html">
                myspace/context/MySpaceContext.rb
                </a>
        <br />
            </td>
        </tr>

        <tr class="top-aligned-row">
            <td><strong>Parent:</strong></td>
            <td>
                Object
            </td>
        </tr>
        </table>
    </div>
  <!-- banner header -->

  <div id="bodyContent">



  <div id="contextContent">



   </div>

    <div id="method-list">
      <h3 class="section-bar">Methods</h3>

      <div class="name-list">
      <a href="#M000063">appdata_to_hash</a>&nbsp;&nbsp;
      <a href="#M000059">call_myspace_api</a>&nbsp;&nbsp;
      <a href="#M000058">get_access_token</a>&nbsp;&nbsp;
      <a href="#M000057">get_authorization_url</a>&nbsp;&nbsp;
      <a href="#M000056">get_request_token</a>&nbsp;&nbsp;
      <a href="#M000055">new</a>&nbsp;&nbsp;
      <a href="#M000062">remove_empty_strings</a>&nbsp;&nbsp;
      <a href="#M000061">remove_null_values</a>&nbsp;&nbsp;
      <a href="#M000064">validate_identifier</a>&nbsp;&nbsp;
      <a href="#M000060">validate_response</a>&nbsp;&nbsp;
      </div>
    </div>

  </div>


    <!-- if includes -->

    <div id="section">


    <div id="constants-list">
      <h3 class="section-bar">Constants</h3>

      <div class="name-list">
        <table summary="Constants">
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">APPLICATION_TYPE_ONSITE</td>
          <td>=</td>
          <td class="context-item-value">'onsite'      unless const_defined?('APPLICATION_TYPE_ONSITE')</td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">APPLICATION_TYPE_OFFSITE</td>
          <td>=</td>
          <td class="context-item-value">'offsite'     unless const_defined?('APPLICATION_TYPE_OFFSITE')</td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">OAUTH_SITES</td>
          <td>=</td>
          <td class="context-item-value">{       :prod =&gt; 'http://api.myspace.com',       :stage =&gt; 'http://stage-api.myspace.com', #      :prod =&gt; '', #      :stage =&gt; '',     } unless const_defined?('OAUTH_SITES')</td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">OAUTH_REQUEST_TOKEN_URL</td>
          <td>=</td>
          <td class="context-item-value">'/request_token'  unless const_defined?('OAUTH_REQUEST_TOKEN_URL')</td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">OAUTH_AUTHORIZATION_URL</td>
          <td>=</td>
          <td class="context-item-value">'/authorize'      unless const_defined?('OAUTH_AUTHORIZATION_URL')</td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">OAUTH_ACCESS_TOKEN_URL</td>
          <td>=</td>
          <td class="context-item-value">'/access_token'   unless const_defined?('OAUTH_ACCESS_TOKEN_URL')</td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">TIMEOUT_SECS</td>
          <td>=</td>
          <td class="context-item-value">123213213213 unless const_defined?('TIMEOUT_SECS')</td>
          <td width="3em">&nbsp;</td>
          <td class="context-item-desc">
tests regularly timeout at 2 seconds

</td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">ID_REGEXP</td>
          <td>=</td>
          <td class="context-item-value">/[0-9]+/ unless const_defined?('ID_REGEXP')</td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">PERSON_ID_REGEXP</td>
          <td>=</td>
          <td class="context-item-value">/@me|[0-9]/ unless const_defined?('PERSON_ID_REGEXP')</td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">ALBUM_ID_REGEXP</td>
          <td>=</td>
          <td class="context-item-value">/myspace.com.album.[0-9]|[0-9]/ unless const_defined?('ALBUM_ID_REGEXP')</td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">SELECTOR</td>
          <td>=</td>
          <td class="context-item-value">/@self|@friends/ unless const_defined?('SELECTOR')</td>
        </tr>
        </table>
      </div>
    </div>



    <div id="attribute-list">
      <h3 class="section-bar">Attributes</h3>

      <div class="name-list">
        <table>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">access_token</td>
          <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
          <td class="context-item-desc"></td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">consumer</td>
          <td class="context-item-value">&nbsp;[R]&nbsp;</td>
          <td class="context-item-desc"></td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">http_logger</td>
          <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
          <td class="context-item-desc"></td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">request_token</td>
          <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
          <td class="context-item-desc"></td>
        </tr>
        </table>
      </div>
    </div>
      


    <!-- if method_list -->
    <div id="methods">
      <h3 class="section-bar">Public Class methods</h3>

      <div id="method-M000063" class="method-detail">
        <a name="M000063"></a>

        <div class="method-heading">
          <a href="MySpaceContext.src/M000063.html" target="Code" class="method-signature"
            onclick="popupCode('MySpaceContext.src/M000063.html');return false;">
          <span class="method-name">appdata_to_hash</span><span class="method-args">(appdata = {}) {|if block_given?| ...}</span>
          </a>
        </div>
      
        <div class="method-description">
        </div>
      </div>

      <div id="method-M000055" class="method-detail">
        <a name="M000055"></a>

        <div class="method-heading">
          <a href="MySpaceContext.src/M000055.html" target="Code" class="method-signature"
            onclick="popupCode('MySpaceContext.src/M000055.html');return false;">
          <span class="method-name">new</span><span class="method-args">(oauth_token_key, oauth_token_secret, params = {})</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Save the application key/secret(s) and initialize <a
href="OAuth.html">OAuth</a> code.
</p>
<p>
If optional param +:application_type+ is passed, it must be one of
+MySpace::APPLICATION_TYPE_ONSITE+ or +MySpace::APPLICATION_TYPE_OFFSITE+.
If the application is an onsite application, an access token is not
required, since the user must separately give your application permission
to access their data. If the application is an offsite application, it must
get an access token from the user to access their data.
</p>
<p>
If optional param +:request_token+ is passed +:request_token_secret+ must
also be passed, and they will be used to create the default argument to
+MySpace#get_access_token+ below. If optional param +:access_token+ is
passed, +:access_token_secret+ must also be passed, and they will be used
to create the access token for the REST API calls.
</p>
<p>
If optional param +:site+ is passed, it must be either +:prod+ or +:stage+,
and <a href="../MySpace.html">MySpace</a> <a href="OAuth.html">OAuth</a>
calls will be directed to either the production or stage API server
accordingly.
</p>
        </div>
      </div>

      <div id="method-M000062" class="method-detail">
        <a name="M000062"></a>

        <div class="method-heading">
          <a href="MySpaceContext.src/M000062.html" target="Code" class="method-signature"
            onclick="popupCode('MySpaceContext.src/M000062.html');return false;">
          <span class="method-name">remove_empty_strings</span><span class="method-args">(hash)</span>
          </a>
        </div>
      
        <div class="method-description">
        </div>
      </div>

      <div id="method-M000061" class="method-detail">
        <a name="M000061"></a>

        <div class="method-heading">
          <a href="MySpaceContext.src/M000061.html" target="Code" class="method-signature"
            onclick="popupCode('MySpaceContext.src/M000061.html');return false;">
          <span class="method-name">remove_null_values</span><span class="method-args">(hash)</span>
          </a>
        </div>
      
        <div class="method-description">
        </div>
      </div>

      <h3 class="section-bar">Public Instance methods</h3>

      <div id="method-M000059" class="method-detail">
        <a name="M000059"></a>

        <div class="method-heading">
          <a href="MySpaceContext.src/M000059.html" target="Code" class="method-signature"
            onclick="popupCode('MySpaceContext.src/M000059.html');return false;">
          <span class="method-name">call_myspace_api</span><span class="method-args">(name, params = {}, &amp;block)</span>
          </a>
        </div>
      
        <div class="method-description">
        </div>
      </div>

      <div id="method-M000058" class="method-detail">
        <a name="M000058"></a>

        <div class="method-heading">
          <a href="MySpaceContext.src/M000058.html" target="Code" class="method-signature"
            onclick="popupCode('MySpaceContext.src/M000058.html');return false;">
          <span class="method-name">get_access_token</span><span class="method-args">(request_token = @request_token)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Get an access token once the user has authorized us.
</p>
        </div>
      </div>

      <div id="method-M000057" class="method-detail">
        <a name="M000057"></a>

        <div class="method-heading">
          <a href="MySpaceContext.src/M000057.html" target="Code" class="method-signature"
            onclick="popupCode('MySpaceContext.src/M000057.html');return false;">
          <span class="method-name">get_authorization_url</span><span class="method-args">(request_token, callback_url)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Get the url to which to redirect the user in order to authorize our access
to their account. This url will redirect back to <tt>callback_url</tt> once
the user authorizes us.
</p>
        </div>
      </div>

      <div id="method-M000056" class="method-detail">
        <a name="M000056"></a>

        <div class="method-heading">
          <a href="MySpaceContext.src/M000056.html" target="Code" class="method-signature"
            onclick="popupCode('MySpaceContext.src/M000056.html');return false;">
          <span class="method-name">get_request_token</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Get an unauthorized request token from <a
href="../MySpace.html">MySpace</a>.
</p>
        </div>
      </div>

      <div id="method-M000064" class="method-detail">
        <a name="M000064"></a>

        <div class="method-heading">
          <a href="MySpaceContext.src/M000064.html" target="Code" class="method-signature"
            onclick="popupCode('MySpaceContext.src/M000064.html');return false;">
          <span class="method-name">validate_identifier</span><span class="method-args">(parameter, identifier)</span>
          </a>
        </div>
      
        <div class="method-description">
        </div>
      </div>

      <div id="method-M000060" class="method-detail">
        <a name="M000060"></a>

        <div class="method-heading">
          <a href="MySpaceContext.src/M000060.html" target="Code" class="method-signature"
            onclick="popupCode('MySpaceContext.src/M000060.html');return false;">
          <span class="method-name">validate_response</span><span class="method-args">(response, url)</span>
          </a>
        </div>
      
        <div class="method-description">
        </div>
      </div>


    </div>


  </div>


<div id="validator-badges">
  <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>

</body>
</html>